import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/style/base.sass'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
// import echarts from 'echarts'

Vue.use(ElementUI)
// console.log(echarts)
//请求的过期时间
axios.defaults.timeout = 30000;
//接口地址的公共前缀
axios.defaults.baseURL = '/equipment'
//配置响应拦截器，请求时，在.then之前执行
axios.interceptors.response.use(function ({data}) {
	// 对响应数据做点什么
	if(data.code){
		Vue.prototype.$message.error(data.msg)
	}
	if(data.code == 9){
		// localtion.href = './#login'
		router.push("/login")
	}
	return data;
}, function (error) {
	// 对响应错误做点什么
	return Promise.reject(error);
});
Vue.prototype.axios = axios;

// Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
